import {
    list,
    saveOperator,
    getOperatorById,
    enabledControl
} from '@/services/operator/operatorService';

export default {
    namespace: 'operatorModel',

    state: {},

    effects: {
        *list({payload, callback}, {call, put}) {
            const response = yield call(list, payload);
            if (callback) callback(response);
        },
        *saveOperator({payload, callback}, {call, put}) {
            const response = yield call(saveOperator, payload);
            if (callback) callback(response);
        },
        *getOperatorById({payload, callback}, {call, put}) {
            const response = yield call(getOperatorById, payload);
            if (callback) callback(response);
        },
        *enabledControl({ payload, callback }, { call, put }) {
            const response = yield call(enabledControl, payload);
            if(callback) callback(response);
        }
    },

    reducers: {},
};
